import request from '@/utils/request'

// 查询商品信息列表
export function listGoods(query) {
  return request({
    url: '/system/goods/list',
    method: 'get',
    params: query
  })
}
// 查询库存低于30商品信息列表
export function listLittleGoods(query) {
  return request({
    url: '/system/goods/listLittleGoods',
    method: 'get',
    params: query
  })
}


// 查询商品信息详细
export function getGoods(goodsId) {
  return request({
    url: '/system/goods/' + goodsId,
    method: 'get'
  })
}

// 新增商品信息
export function addGoods(data) {
  return request({
    url: '/system/goods',
    method: 'post',
    data: data
  })
}

// 修改商品信息
export function updateGoods(data) {
  return request({
    url: '/system/goods',
    method: 'put',
    data: data
  })
}

// 删除商品信息
export function delGoods(goodsId) {
  return request({
    url: '/system/goods/' + goodsId,
    method: 'delete'
  })
}

// 导出商品信息
export function exportGoods(query) {
  return request({
    url: '/system/goods/export',
    method: 'get',
    params: query
  })
}
export function changeState(data) {
  return request({
    url: '/system/goods/changeState',
    method: 'post',
    data: data
  })
}

export function getKeepGoods(goodsId) {
  return request({
    url: '/system/goods/keep/' + goodsId,
    method: 'get'
  })
}

export function addWholeGoods(goodsId,wholeGoodsId) {
  return request({
    url: '/system/goods/establish',
    method: 'post',
    params: {goodsId:goodsId,wholeGoodsId:wholeGoodsId}
  })
}

export function deleteWholeGoods(goodsId) {
  return request({
    url: '/system/goods/relieve',
    method: 'get',
    params: {goodsId:goodsId}
  })
}



// 捶一捶
export function listBeatGoods(query) {
  return request({
    url: '/system/beatGoods/list',
    method: 'get',
    params: query
  })
}
export function addBeatGoods(data) {
  return request({
    url: '/system/beatGoods',
    method: 'post',
    data: data
  })
}
export function updateBeatGoods(data) {
  return request({
    url: '/system/beatGoods',
    method: 'put',
    data: data
  })
}
